<template>
  <a-form
    class="search-form"
    :label-col="{ span: labelCol }"
    :wrapper-col="{ span: wrapperCol }"
  >
    <a-row>
      <slot></slot>
      <a-col flex="auto">
        <a-form-item :wrapper-col="{ span: 24 }" class="search-form-btn">
          <a-space>
            <a-button type="primary" html-type="submit" @click="emit('search')">
              <SearchOutlined />
              <span v-if="!hideBtnText">{{ t("查询") }}</span>
            </a-button>
            <a-button @click="emit('reset')">
              <SyncOutlined />
              <span v-if="!hideBtnText">{{ t("重置") }}</span>
            </a-button>
          </a-space>
        </a-form-item>
      </a-col>
    </a-row>
  </a-form>
</template>
<script lang="ts" setup name="DysSearchForm">
import { useI18n } from "vue-i18n";

interface Props {
  /**查询按钮权限 */
  auth?: string;
  /**文本占宽 */
  labelCol?: number;
  /**控件占宽 */
  wrapperCol?: number;
  /**隐藏搜索按钮文本 */
  hideBtnText?: boolean;
}
withDefaults(defineProps<Props>(), {
  auth: "SEARCH",
  labelCol: 8,
  wrapperCol: 16,
});
const emit = defineEmits(["search", "reset"]);
const { t } = useI18n();
</script>
